/* eslint-disable */
// 该文件由 OneAPI 自动生成，请勿手动修改！
import {apiPrefixDispose} from '@/utils/format';
import {request} from '@umijs/max';


/**
 * webhook支持的app
 */
export async function apps<T = any>() {
  return request<API.ResultVO<Array<API.WebHookApp>>>(apiPrefixDispose('/msg/webhook/apps'), {
    method: 'GET',
  });
}

/**
 * 发消息测试
 */
export async function testMsg<T = any>(id: number) {
  return request<API.ResultVO<any>>(apiPrefixDispose(`/msg/webhook/testMsg`), {
    method: 'GET',
    params: {
      'id':id,
    },
  });
}


/**
 * 根据ID获取详情
 */
export async function info<T = any>(id: number) {
  return request<API.ResultVO<API.WebHook>>(apiPrefixDispose(`/msg/webhook/${id}`), {
    method: 'GET',
  });
}


/**
 * 新增webhook
 */
export async function append<T = any>(
  body: API.WebHookAdd,
  options?: { [key: string]: any },
) {
  body.secretType = body.secretType.toUpperCase(); // 确保 type 是大写的
  body.app = body.app.toUpperCase(); // 确保 app 是大写的
  return request<API.ResultVO<string>>(apiPrefixDispose(`/msg/webhook/append`), {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}



/**
 * 分页查询webhook
 */
export async function page<T = any>(body: API.WebHookPage) {
  return request<API.ResultPageVO<API.WebHook>>(apiPrefixDispose('/msg/webhook/page'), {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
  });
}




/**
 * 集合
 */
export async function lists<T = any>() {
  return request<API.ResultVO<Array<API.WebHook>>>(apiPrefixDispose(`/msg/webhook/lists`), {
    method: 'GET',
  });
}


/**
 * 查询指定app的webhook集合
 */
export async function listsApp<T = any>(app:string) {
  return request<API.ResultVO<Array<API.WebHook>>>(apiPrefixDispose(`/msg/webhook/lists/app`), {
    method: 'GET',
    params: {
      'app':app,
    },
  });
}


/**
 * 删除webhook
 */
export async function deleteById<T = any>(
  id: number,
  options?: { [key: string]: any },
) {
  return request<API.ResultVO<string>>(apiPrefixDispose(`/msg/webhook/delete`), {
    method: 'GET',
    params: {'id':id},
    ...(options || {}),
  });
}



/**
 * 编辑webhook
 */
export async function edit<T = any>(
  body: API.WebHookEdit,
  options?: { [key: string]: any },
) {
  return request<API.ResultVO<string>>(apiPrefixDispose(`/msg/webhook/edit`), {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}
